fix: use chat_template_kwargs for DeepSeek V3.1 Terminus reasoning control #9081
+181
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses Issue #8270 based on @bozoweed's suggestion.
Problem
When using DeepSeek V3.1 Terminus via OpenRouter, reasoning/thinking appears to be enabled by default with no way to turn it off. This leads to worse answers for some tasks and increases token usage.
Solution
Following @bozoweed's insight, this PR implements the
chat_template_kwargsapproach with thethinkingparameter for DeepSeek V3.1 Terminus models:chat_template_kwargsin the OpenRouter handlerchat_template_kwargs: { thinking: boolean }reasoningparameter for these models (replaced bychat_template_kwargs)thinking: falsewhen no reasoning is configuredChanges
Testing
thinking: truewhen reasoning is enabledthinking: falsewhen reasoning is disabled (default)chat_template_kwargsfor non-Terminus modelsFixes #8270
Thanks to @bozoweed for the solution!
Important
Introduces
chat_template_kwargsfor DeepSeek V3.1 Terminus models to control reasoning, replacing thereasoningparameter.chat_template_kwargswiththinkingparameter for DeepSeek V3.1 Terminus models inopenrouter.ts.reasoningparameter for these models, defaultsthinking: falseif not configured.openrouter.spec.tsto verifythinking: truewhen reasoning is enabled,thinking: falsewhen disabled.chat_template_kwargsfor non-Terminus models.This description was created by
for 52be5e5. You can customize this summary. It will automatically update as commits are pushed.